package com.fuqi.android.zhongcai.business.shuig;

import com.fuqi.android.zhongcai.business.shuig.view.widget.CJRow.ARResponse;
import com.fuqi.android.zhongcai.utils.dic.impl.Field;
import com.fuqi.android.zhongcai.utils.dic.impl.Table;
import com.fuqi.framework.utils.StringUtil;


public class ShuiGBuz {
	// 订单基本信息
	public static Table getBaseTable() {
		Table table = new Table();
		table.addField(new Field("CREATE_TYPE", "下订单人员", 1));
//		table.addField(new Field("CUSTOMER_ID", "客户ID", 1));
		table.addField(new Field("ORDER_COMEFROM", "订单来源", 2));
		table.addField(new Field("CREATE_DATE", "下单时间", 3));
		table.addField(new Field("ORDER_ID", "订单编号",4));
		return table;
	}

	// 订单客户信息
	public static Table getClientTable() {
		Table table = new Table();
		table.addField(new Field("SALSE_NAME", "业务员", 8));
		table.addField(new Field("OWNER_NAME", "业主姓名", 9));
		table.addField(new Field("OWNER_PHONE", "业主电话", 10));
		table.addField(new Field("CONTACT_NAME", "项目经理", 11));
		table.addField(new Field("CONTACT_PHONE", "项目经理电话", 12,2));
		table.addField(new Field("INSTALL_CONTENT", "安装内容",13));
		table.addField(new Field("INSTALL_DATE", "安装日期", 14));
		table.addField(new Field("ADDR_DETAIL", "安装地址",15));
		table.addField(new Field("HOUSE_TYPE", "户型", 16));
		table.addField(new Field("PRODUCT_TYPE", "PPR系列",17));
		table.addField(new Field("PAY_TYPE", "结款方式", 18));
		table.addField(new Field("REMARK", "备注",19));
		return table;
	}

	public static Table getClientDNTable() {
		Table table = new Table();
		table.addField(new Field("SALSE_NAME", "业务员", 8));
		table.addField(new Field("OWNER_NAME", "业主姓名", 9));
		table.addField(new Field("OWNER_PHONE", "业主电话", 10));
		table.addField(new Field("CONTACT_NAME", "项目经理", 11));
		table.addField(new Field("CONTACT_PHONE", "项目经理电话", 12,2));
		table.addField(new Field("INSTALL_CONTENT", "安装内容",13));
		table.addField(new Field("INSTALL_DATE", "安装日期", 14));
		table.addField(new Field("ADDR_DETAIL", "安装地址",15));
		table.addField(new Field("HOUSE_TYPE", "户型", 16));
		table.addField(new Field("PRODUCT_TYPE", "产品套餐",17));
		table.addField(new Field("PAY_TYPE", "结款方式", 18));
		table.addField(new Field("REMARK", "备注",19));
		return table;
	}


	public static Table getStatusTable() {
		Table table = new Table();
//		table.addField(new Field("APPROVE_DATE", "审核时间", 1));
		table.addField(new Field("ORDER_STATUS", "订单状态", 2));
		table.addField(new Field("INNER_NAME", "内勤",3,2));
		table.addField(new Field("CAPTAIN_NAME", "施工部",4,2));
		table.addField(new Field("DISPATCH_DATE", "派单时间", 5));
		table.addField(new Field("USE_METER", "预期使用米数", 6));
		table.addField(new Field("CAPTAIN_REMARK", "施工部备注", 7));
		table.addField(new Field("CHARGEHAND_NAME", "工人",8,2));
		table.addField(new Field("WORKER_NAMES", "",9));
		table.addField(new Field("SET_OUT_DATE", "出发时间",10));

		table.addField(new Field("INSTALL_START_DATE", "安装时间",11));
		table.addField(new Field("FINISH_DATE", "完成时间",12));
		table.addField(new Field("COMMENT_DATE", "评论时间",13));
		table.addField(new Field("VISIT_DATE", "回访时间",14));
		table.addField(new Field("CHECK_DATE", "抽查时间",15));
		table.addField(new Field("CHECK_NAME", "监理",16,2));

		table.addField(new Field("REFUSE_REASON", "不可施工原因",18));
		table.addField(new Field("REFUSE_DATE", "下次安装日期",19));
		table.addField(new Field("REFUSE_REMARK", "工人备注",20));
		table.addField(new Field("PIC_REFUSE", "不可施工照片",21));
		table.addField(new Field("REFUSE_DATE", "提交时间",22));
		return table;
	}

	public static Table getStatusDNTable() {
		Table table = new Table();
//		table.addField(new Field("APPROVE_DATE", "审核时间", 1));
		table.addField(new Field("ORDER_STATUS", "订单状态", 2));
		table.addField(new Field("INNER_NAME", "内勤",3,2));
		table.addField(new Field("CAPTAIN_NAME", "施工部",4,2));
		table.addField(new Field("DISPATCH_DATE", "派单时间", 5));
		table.addField(new Field("WORK_AREA", "施工面积", 6));
		table.addField(new Field("DNG_METER", "地暖管米数", 7));
		table.addField(new Field("FSQ_COUNT", "分水器数量", 8));
		table.addField(new Field("WKMB_COUNT", "温控面板数量", 9));
		table.addField(new Field("ZGDGG", "主管道规格", 10));
		table.addField(new Field("ZGD_METER", "主管道米数", 11));
		table.addField(new Field("CAPTAIN_REMARK", "施工部备注", 12));
		table.addField(new Field("CHARGEHAND_NAME", "工人",13,2));
		table.addField(new Field("WORKER_NAMES", "",14));
		table.addField(new Field("SET_OUT_DATE", "出发时间",15));

		table.addField(new Field("INSTALL_START_DATE", "安装时间",16));
		table.addField(new Field("FINISH_DATE", "完成时间",17));
		table.addField(new Field("COMMENT_DATE", "评论时间",18));
		table.addField(new Field("VISIT_DATE", "回访时间",19));
		table.addField(new Field("CHECK_DATE", "抽查时间",20));
		table.addField(new Field("CHECK_NAME", "监理",21,2));

		table.addField(new Field("REFUSE_REASON", "不可施工原因",22));
		table.addField(new Field("REFUSE_DATE", "下次安装日期",23));
		table.addField(new Field("REFUSE_REMARK", "工人备注",24));
		table.addField(new Field("PIC_REFUSE", "不可施工照片",25));
		table.addField(new Field("REFUSE_DATE", "提交时间",26));
		return table;
	}

	public static void getUserStatusTable(Table table) {
		if(table!=null) {
			table.getField("WORK_AREA").setCanShow(false);
			table.getField("DNG_METER").setCanShow(false);
			table.getField("FSQ_COUNT").setCanShow(false);
			table.getField("WKMB_COUNT").setCanShow(false);
			table.getField("ZGDGG").setCanShow(false);
			table.getField("ZGD_METER").setCanShow(false);
		}
	}

	public static ARResponse getMockBaseResponse(){
		String str = "{\"data\":{\"ORDER_COMEFROM\":\"\",\"CREATE_DATE\":\"\"," +
				"\"ORDER_ID\":\"\",\"CONTACT_NAME\":\"\",\"CONTACT_PHONE\":\"\",\"INSTALL_CONTENT\":\"\",\"ADDR_DETAIL\":\"\"}}";
		return new ARResponse(str);
	}

	public static void makeHide(Table table,ARResponse response){
		for (Field field : table.getFieldList()) {
			if(StringUtil.isEmpty(response.getValue(field.getFieldName()))){
				field.setCanShow(false);
//				table.getFieldList().remove(field);
			}
		}
	}
}
